﻿@using Model.Admin;
@using Xproject.Util;
@using Model.WXshopBuiness;
@{
    string Domain = CommonHelper.GetAppSettings("Domin");
    Layout = "~/Views/Shared/_JSlayout.cshtml";
    string HProductId = (string )ViewBag.ProductId;
}
@model ProductSpecification
<div class="gray-bg">
    <div class="wrapper wrapper-content animated fadeInRight">
        <div class="row">
            <div class="col-sm-12">
                <div class="ibox float-e-margins">
                    <div class="ibox-content">
                        <form class="form-horizontal m-t" id="userinfo" action="~/WXProduct/EditProductSpeci" method="post">
                            <div class="form-group">
                                <label class="col-sm-3 control-label">规格名称：</label>
                                <div class="col-sm-8">
                                    <input class="control-label" name="SpecificationName" value="@(Model!=null?Model.SpecificationName:"") " />
                                </div>
                            </div>
                            <div class="form-group">
                                <label class="col-sm-3 control-label">出售价：</label>
                                <div class="col-sm-8">
                                    <input class="control-label" name="SalesPrice" required value="@(Model!=null?Model.SalesPrice:0) " />
                                </div>
                            </div>
                            <div class="form-group">
                                <label class="col-sm-3 control-label">标价：</label>
                                <div class="col-sm-8">
                                    <input class="control-label" name="OrignPrice" required value="@(Model!=null?Model.OrignPrice:0) " />
                                </div>
                            </div>
                            <div class="form-group">
                                <label class="col-sm-3 control-label">成本价：</label>
                                <div class="col-sm-8">
                                    <input class="control-label" name="CostPrice" required value="@(Model!=null?Model.CostPrice:0) " />
                                </div>
                            </div>
                            <div class="form-group">
                                <label class="col-sm-3 control-label">库存：</label>
                                <div class="col-sm-8">
                                    <input class="control-label" name="Stock" value="@(Model!=null?Model.Stock:0) " />
                                </div>
                            </div>
                            <div class="form-group">
                                <label class="col-sm-3 control-label">备注：</label>
                                <div class="col-sm-8">
                                    <input id="Email" type="Remarks" value="@(Model!=null?Model.Remarks:"") " class="form-control" name="Remarks" required aria-required="true">
                                </div>
                            </div>
                            <div class="form-group">
                                <label class="col-sm-3 control-label">排序：</label>
                                <div class="col-sm-8">
                                    <input id="Mobile" type="number" class="form-control" name="Sort" required value="@(Model!=null?Model.Sort:0)">
                                </div>
                            </div>

                            <div class="form-group">
                                <div class="col-sm-4 col-sm-offset-3">
                                    <input type="hidden" name="SpecificationId" value="@(Model!=null?Model.ProductSpecificationId:"")" />
                                    <input type="hidden" name="ProductId" value="@(Model!=null?Model.ProductId:HProductId)" />
                                    <button class="btn btn-primary" type="submit">修改</button>
                                </div>
                            </div>
                        </form>
                    </div>
                </div>
            </div>
        </div>
    </div>
</div>
<script type="text/javascript">

    $(document).ready(function () {
        var optionsNew = {
            beforeSubmit: function () {
                //layer.open({ type: 2, time: 2 });
                layer.load(1, { shade: [0.1, '#000'], time: 2000 });
            },
            success: function (data) {
                if (data.Success == true) {
                    layer.alert('编辑成功', { icon: 1, skin: 'layer-ext-moon', time: 2000 });
                    // layer.open({ content: '新增成功', style: 'color:black; ', time: 2 });
                    // window.location.href = "~/Home/Index" + "?id=" + 10000 * Math.random();
                } else {
                    layer.alert(data.Data, { icon: 1, skin: 'layer-ext-moon', time: 2 });
                    //layer.open({ content: data.Data, style: 'color:black; ', time: 2 });
                }
            },
            error: function () {
                alert(JSON.stringify(data));
            },
            type: "post",
            clearForm: false,
            timeout: 100000
        };

        $("#userinfo").submit(function () {
            $("#userinfo").ajaxSubmit(optionsNew);// type="button"
            return false;
        });
    });


</script>
